<template>
  <el-dialog :visible.sync="isShowDialog">
    <div slot="title" style="text-align: center">{{title}}</div>
    <slot></slot>
    <div slot="footer" class="dialog-footer">
      <el-button v-for="item in needBtn" :type="item.type" :key="item.title" @click="closeDailog(item.type)">{{item.title}}</el-button>
      <!-- <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button> -->
    </div>
  </el-dialog>
</template> 

<script>
export default {
  name: 'toastDialog',
  props: {
    title: {
      type: String,
      default: ''
    },
    needBtn: {
      type: Array,
      default () {
        return  [
          {
            type: '',
            title: '取 消'
          },
          {
            type: 'primary',
            title: '确 定'
          }
        ]
      }
    }
  },
  data () {
    return {
      isShowDialog: false
    }
  },
  methods: {
    closeDailog (type) {
      if (type) { // 点击确认
        this.$emit('submitForm')
      }
      this.isShowDialog = false
    }
  }
}
</script>

<style lang="less" scoped>
 /deep/.el-dialog__body{
   height: auto;
   overflow: auto;
  }
</style>
